// Client

AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")

// Include

include('shared.lua')

// Initialize

function ENT:Initialize()
	self.Entity:PhysicsInit(SOLID_VPHYSICS)
	self.Entity:SetMoveType(MOVETYPE_VPHYSICS)
	self.Entity:SetSolid(SOLID_VPHYSICS)
	self.Entity:SetUseType(ONOFF_USE)
	self.Entity:SetNetworkedInt(0, 0)
end

// Setup

function ENT:Setup()
	// Timer
	
	self.Entity.Timer = "Timer Tool: "..self.Entity:EntIndex()
	
	timer.Remove(self.Entity.Timer)
	timer.Create(self.Entity.Timer, self.Entity.Interval, 0, self.Press, self.Entity)
end

// When entity is removed

function ENT:OnRemove()
	timer.Remove(self.Entity.Timer)
end

// Toggle the entity

function ENT:Press()
	local Player = self:GetEntityPlayer()
	local Index  = self:GetEntityIndex()
	local Key 	 = self:GetEntityKey()
	
	numpad.Activate(Player, _, {Key}, Index)
	numpad.Deactivate(Player, _, {Key}, Index)
end